home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / MacPerl 5.0.3 / Preinstalled MacPerl (FAT) / lib / Sys / Hostname.pm next >
Encoding:
Text File  |  1995-03-20  |  361 b   |  26 lines  |  [TEXT/McPL]

  1. # by David Sundstrom   sunds@asictest.sc.ti.com
  2. #    Texas Instruments
  3.  
  4. package Sys::Hostname;
  5.  
  6. use Carp;
  7. require Exporter;
  8. @ISA = qw(Exporter);
  9. @EXPORT = qw(hostname);
  10.  
  11. #
  12. # Try every conceivable way to get hostname.
  13.  
  14. sub hostname {
  15.  
  16.     # method 1 - we already know it
  17.     return $host if defined $host;
  18.  
  19.     chop($host = `hostname`);
  20.     
  21.     $host;
  22. }
  23.  
  24. 1;
  25.